<?php
session_start();
$user_id = $_SESSION['id'];
?>
<!-- Left Pane : Plan, Number of Sites hosted, Number of sites available -->
<div id="accountInfo" style="margin-bottom:10px">
  <!--<div style="border:0px solid red;line-height:18px;">-->
  <!--  <b>credits available:&nbsp;</b> -->
    <!--  function getSitesAvail() is defined in /accounts/functions.php-->
    <?php
      $_SESSION['type'] = getPackageType($user_id);
      $sitesAssocWithPackage = getSitesAssocWithPackage($_SESSION['type']);
      //Open the dB pointing to _cd database
      require($_SERVER['DOCUMENT_ROOT'].'/db/opendb_blog.php');
	  $query = "select count(*) from wp_blogs where site_type = 'spw' AND realivent_user='".$_SESSION['id']."'";
  	  $spws = mysql_query($query) or die ("SQL Error".mysql_error());
	  $spws = mysql_fetch_array($spws);
	  $sitesUsed = $spws[0];
	  mysql_close($db);
	  $_SESSION['creditAvail']=$sitesAssocWithPackage - $sitesUsed;
	  //echo $_SESSION['creditAvail'];
    ?>
  <!--</div>-->
  <div style="border:0px solid red;line-height:18px;">
      <b>Active Listings:&nbsp;</b>
      <?php
  	  echo $listingsUsed;

  	  require($_SERVER['DOCUMENT_ROOT'].'/db/opendb.php');
      $query = "select count(p.OID) from PROPERTIES p inner join Prop_Owner_Con c on p.OID = c.Prop_OID where c.Owner = '".$_SESSION['id']."' and p.LISTSTATUS = 'ACTIVE'";
      $listings = mysql_query($query) or die ("SQL Error".mysql_error());
	  $listings = mysql_fetch_array($listings);
	  $listingsUsed = $listings[0];
	  mysql_close($db);

      echo $listingsUsed;
      ?>
  </div>
  <div style="border:0px solid red;line-height:18px;">
        <b>Listings Available:&nbsp;</b>
        <? echo $sitesAssocWithPackage - $listingsUsed; ?>
  </div>
  <div style="border:0px solid red;line-height:18px;">
    <b>Sites in use:&nbsp;</b>
    <!-- get the sites being used : /realiven_wpmu/wp-blogs/site_type=spw-->
    <?php
	  echo $sitesUsed;
	  //Open the dB pointing to wpmu database
	  require($_SERVER['DOCUMENT_ROOT'].'/db/opendb.php');
    ?>
  </div>
  <div style="border:0px solid red;line-height:18px;">
    <a style="text-decoration:none" href="<? $_SERVER['DOCUMENT_ROOT']?>/accounts/changeplan.php" target="_blank">Add more sites</a>
  </div>
  <hr/>
</div>

<STYLE TYPE="text/css" MEDIA="screen, projection">
<!--
  @import url(/accounts/accounts_left_navigation.css);
-->
</STYLE>

<script type="text/javascript" language="javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
<script type="text/javascript">
$.noConflict();
<!--//---------------------------------+
//  Developed by Roshan Bhattarai
//  Visit http://roshanbh.com.np for this script and more.
//  This notice MUST stay intact for legal use
// --------------------------------->
jQuery(document).ready(function()
{
	//slides the element with class "menu_body" when paragraph with class "menu_head" is clicked
	jQuery("#firstpane p.menu_head").click(function()
    {
		jQuery(this).css({backgroundImage:"url(down.png)"}).next("div.menu_body").slideToggle(300).siblings("div.menu_body").slideUp("slow");
       	jQuery(this).siblings().css({backgroundImage:"url(left.png)"});
	});

});
</script>

<?php
	if( ($active == 'mylistings') || ($active == 'profile') )
	{
	?>
  <div style="color:#666; padding-top:20px; border-bottom:none;">
  <h2>Listing Options</h2>
  <br/>
  </div>
  <div id="" class=""> <!--Code for menu starts here-->
<?
   if (isServiceAccessible($_SESSION['type'], "Listings")) {
?>
        <div class="leftNav">
		 <ul>
         <li><a href="new_listing.php">Add a New Listing</a></li>
         <li><a href="listing.php">Manage Your Listings</a></li>
		 </ul>
        </div>
<?
  }
  else
  {
  ?>
  <p class="">Listing Options</p>
		<div class="">
		 <a href="javascript:showUpgradeMessage();">Add a New Listing</a><br/>
         <a href="javascript:showUpgradeMessage();">Manage Your Listings</a>
		</div>
  <?
  }
?>
       </div>

<?php
	}
	if($active == 'marketingmain')
	{
	?>
  <div id="" class=""> <!--Code for menu starts here-->
		<h1>Listing Options</h1>
        
		<div class="leftNav">
		 <ul>
         <li><a href="new_listing.php">Add a New Listing</a></li>
         <li><a href="listing.php">Manage Your Listings</a></li>
		 </ul>
        </div>
        
  </div>
<?php
	}
	if($active == 'addnewlisting')
	{
	?>
  <div id="firstpane" class="menu_list"> <!--Code for menu starts here-->
  <h1>Add a New Listing</h1><br/>
	  <span class="style19">*</span><strong> = Required Information</strong><BR><BR>
	  After you create the listing, you will be able to add pictures, videos, open houses, virtual tour photos and preview your automatically created marketing material.
	  <BR><BR>
		<h1>Help / FAQs</h1>
        <p class="menu_head">Help</p>
		<div class="menu_body">
		 <a href="#">Getting Started</a>
         <a href="#">Adding a Listing</a>
         <a href="#">Creating a Blog</a>
		</div>
		<p class="menu_head">My Activities</p>
		<div class="menu_body">
		 <a href="#">Points Earned</a>
         <!--<a href="points.php">Points Earned</a> -->
         <a href="#">Submit a TIP</a>
         <a href="#">View my TIPS</a>
		</div>
       </div>
<?php
	}
	if($active == 'polls')
	{
	?>
 <div style="font-size:18px; color:#000; padding:10px;">Polls <br/><br/>Help / FAQs</div>
 <div id="firstpane" class="menu_list"> <!--Code for menu starts here-->
		<p class="menu_head">Help</p>
		<div class="menu_body">
		 <a href="#">Getting Started</a>
         <a href="#">Adding a Listing</a>
         <a href="#">Creating a Blog</a>
		</div>
		<p class="menu_head">My Polls</p>
		<div class="menu_body">
		 <a href="#">Add Polls</a>
         <!--<a href="points.php">Points Earned</a> -->
         <a href="#">Manage Polls</a>
         <a href="#">View Polls</a>
		</div>


       </div>

<?php

	}

	if($active == 'network')

	{

	?>


 <div id="firstpane" class="menu_list"> <!--Code for menu starts here-->
 <h1>My Network</h1>
		<p class="menu_head">Help</p>
		<div class="menu_body">
		 <a href="#">Getting Started</a>
         <a href="#">Adding a Listing</a>
         <a href="#">Creating a Blog</a>
		</div>
		<p class="menu_head">My Network</p>
		<div class="menu_body">
		 <a href="connections_snap.php">View Network</a>
         <!--<a href="points.php">Points Earned</a> -->
         <a href="#">Invite Friends</a>
         <a href="#">Recommendations</a>
		</div>


       </div>




<?php

	}

	if($active == 'tutorials')

	{

	?>

  <div id="firstpane" class="menu_list"> <!--Code for menu starts here-->
		<h1>Tutorials</h1>
        <p class="menu_head">Platform</p>
		<div class="menu_body">
		 <a href="<?$_SERVER['DOCUMENT_ROOT']?>/accounts/tutorials/platform_overview.php">Platform Overview</a>
         <a href="<?$_SERVER['DOCUMENT_ROOT']?>/accounts/tutorials/add_listing.php">Adding a Listing</a>
         <!--<a href="#">Creating a Blogsite</a>
         <a href="#">Creating a Flyer</a>
         <a href="#">Lead Management</a>
         <a href="#">Analytics</a>-->
		</div>

        <p class="menu_head">Blogging 101</p>
		<div class="menu_body">
		 <a href="<?$_SERVER['DOCUMENT_ROOT']?>/accounts/tutorials/blog_system_overview.php">Blog System Overview</a>
        <!-- <a href="#">Create a Blog</a>
         <a href="#">Manage Blogs</a>
         <a href="#">Add Blog Feed</a>-->
         <a href="<?$_SERVER['DOCUMENT_ROOT']?>/accounts/tutorials/wp_passwords.php">Passwords & Security</a>
         <a href="<?$_SERVER['DOCUMENT_ROOT']?>/accounts/tutorials/wp_antispam_setup.php">Setting up AntiSPAM</a>
         <a href="<?$_SERVER['DOCUMENT_ROOT']?>/accounts/tutorials/wp_add_gravatar.php">Customizing Gravatar</a>
         <a href="<?$_SERVER['DOCUMENT_ROOT']?>/accounts/tutorials/wp_quickstart.php">Wordpress Quickstart</a>

		</div>

        <p class="menu_head">Blogging 102</p>
		<div class="menu_body"><!--<a href="points.php">Points Earned</a> -->
         <a href="<?$_SERVER['DOCUMENT_ROOT']?>/accounts/tutorials/wp_dashboardintro.php">Wordpress Dashboard</a>
         <a href="<?$_SERVER['DOCUMENT_ROOT']?>/accounts/tutorials/wp_passwords.php">Passwords & Security</a>
         <a href="<?$_SERVER['DOCUMENT_ROOT']?>/accounts/tutorials/wp_writing_posts.php">Writing a Post</a>
         <a href="<?$_SERVER['DOCUMENT_ROOT']?>/accounts/tutorials/wp_writing_pages.php">Writing a Page</a>
         <a href="<?$_SERVER['DOCUMENT_ROOT']?>/accounts/tutorials/wp_pasting_from_word.php">Pasting From Word</a>
         <a href="<?$_SERVER['DOCUMENT_ROOT']?>/accounts/tutorials/wp_adding_pdf.php">Adding PDF to POST</a>
         <a href="<?$_SERVER['DOCUMENT_ROOT']?>/accounts/tutorials/wp_media_library.php">Media Library</a>
         <a href="<?$_SERVER['DOCUMENT_ROOT']?>/accounts/tutorials/wp_adding_galleries_tutorial1.php">Adding Galleries I</a>

         <a href="#">Image Management</a>
         <a href="<?$_SERVER['DOCUMENT_ROOT']?>/accounts/tutorials/wp_linking_basics.php">Linking Basics</a></div>

    <p class="menu_head">Blogging 103</p>
		<div class="menu_body">
		 <a href="<?$_SERVER['DOCUMENT_ROOT']?>/accounts/tutorials/wp_add_listing.php">Adding Listings</a>
         <!--<a href="points.php">Points Earned</a> -->
         <a href="<?$_SERVER['DOCUMENT_ROOT']?>/accounts/tutorials/wp_add_featured_listing_page.php">Create Featured Listing Page</a>
        <!-- <a href="#">Adding Galleries</a>
         <a href="#">Real-time Analytics</a>-->
         </div>

    <p class="menu_head">SEO 101</p>
		<div class="menu_body">
		 <a href="#" title="Coming Soon...">Overview</a>
         <!--<a href="points.php">Points Earned</a> -->
        <!-- <a href="#">Meta Tags</a>
         <a href="#">SEO Images</a>
         <a href="#">Link Building</a>
         <a href="#">Directory Submissions</a>-->
		</div>

         <p class="menu_head">SEO 102</p>
		 <div class="menu_body">

		</div>

        <p class="menu_head">SEO 103</p>
		 <div class="menu_body">

		</div>

        <p class="menu_head">Google Analytics</p>
		 <div class="menu_body">
		 <a href="/accounts/tutorials/google_analytics_overview.php">Get your GA Code</a>
         <a href="#">Dashboard Basics</a>
         <a href="#">Advanced 201</a>
         <a href="#">Advanced 202</a>
		</div>

        <p class="menu_head">Facebook</p>
		 <div class="menu_body">
         <a href="#" title="Coming soon...">FB Integration</a>
     	</div>

        <p class="menu_head">Twitter</p>
		 <div class="menu_body">
         <a href="#" title="Coming soon...">Twitter Integration</a>
        </div>

        </div>

<?php
	}
	if($active == 'myblog')
	{
	?>
 <h2>Blogging Options</h2><br/>
 <div id="" class=""> <!--Code for menu starts here-->
        
		<div class="leftNav">
         <ul>
         <li><a href="blogsystem.php">Blog System</a></li>
		 <li><a href="add_new_propblog.php?id=<?php echo $user_id ?>">Create a Blog</a></li>
         <li><a href="allmyblogs.php?id=<?php echo $user_id ?>">View Blogs</a></li>
         <li><a href="download_plugins.php">Download Plugins</a></li>
         <li><a href="addblogfeed.php?page=add">Add a Blog Feed</a></li>
		</ul>
        </div>
        
 </div>
<?php
	}
	if($active == 'flyers')
	{
	?>

<?php

	}

	?>